// #sijapp cond.if modules_FILES="true"#
package jimm.modules.fs;

import java.util.*;
import java.io.*;
import jimm.*;

public abstract class FileSystem {

    public static final String ROOT_DIRECTORY = "/";
    public static final String PARENT_DIRECTORY = "../";
    static private final boolean supports_JSR75 = supportJSR75();

    static private boolean supportJSR75() {
        // #sijapp cond.if modules_ANDROID isnot "true"# //add android fs
        try {
            return Class.forName("javax.microedition.io.file.FileConnection") != null;
        } catch (ClassNotFoundException e) {
        }
        return false;
        // #sijapp cond.else #                           //add android fs
        return true;                                     //add android fs
        // #sijapp cond.end #                            //add android fs
    }

    public static boolean isSupported() {
        return supports_JSR75;
    }

    public static FileSystem getInstance() {
        return new JSR75FileSystem();
    }

    public abstract Vector getDirectoryContents(String dir, boolean onlyDirs) throws JimmException;

    public abstract void openFile(String file) throws JimmException;

    public abstract OutputStream openOutputStream() throws Exception;

    public abstract InputStream openInputStream() throws Exception;

    public abstract void close();

    public abstract long fileSize() throws Exception;

    public abstract long totalSize() throws Exception;

    public abstract String getName();
}
// #sijapp cond.end#
